package com.jzo2o.market.controller.consumer;

import com.jzo2o.market.model.dto.response.CouponInfoResDTO;
import com.jzo2o.market.service.ICouponService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
@RestController("consumerCouponController")
@RequestMapping("/consumer/coupon")
public class ConsumerCouponController {
    @Resource
    private ICouponService couponService;
    @GetMapping("/my")
    @ApiOperation("我的优惠券列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "status", value = "优惠券状态，1:未使用，2:已使用，3:已过期", required = true, dataType = "Integer"),
            @ApiImplicitParam(name = "lastId", value = "上一页最后一条记录的id", required = false, dataType = "Integer")
    })
    public List<CouponInfoResDTO> myCouponList(@RequestParam("status") Integer status, @RequestParam(value = "lastId", required = false) Integer lastId){

        return couponService.queryCouponList(status,lastId);
    }
}
